#include <stdio.h>
#include <pthread.h>
#include <unistd.h>

void *thread_run(void *args)
{
  while(1) {
    printf("新线程，我的线程ID是：%lu\n",pthread_self());
    sleep(1);
  }
}

int main()
{
  pthread_t tid[5];
  for(int i = 0;i < 5;i++)
  {
    pthread_create(tid+i,NULL,thread_run,(void*)"new thread");
  }

  while(1) {
    for(int i = 0;i < 5;i++)
    {
      printf("主线程，我创建的线程[%d号]ID是：%lu\n",i+1,tid);
      sleep(1);
    }
  }

  return 0;
}
